#include "StdAfx.h"
#include "DD_ImageCap.h"

#include "xhImageCap.h"

DD_ImageCap::DD_ImageCap()
{
	m_pxhImageCap = NULL;
}

DD_ImageCap::~DD_ImageCap()
{
	MySafeDelete(m_pxhImageCap);
}

#define DKQ_SECT {if( NULL== m_pxhImageCap ) return -1;}

int DD_ImageCap::Initialize()
{
	if( NULL == m_pxhImageCap )
	{
		m_pxhImageCap = new xhImageCap;
	}

	DKQ_SECT
	return m_pxhImageCap->Initialize();
}

int DD_ImageCap::UnInitialize()
{
	DKQ_SECT
	return m_pxhImageCap->UnInitialize();
}


int DD_ImageCap::SearchCapture()
{
	DKQ_SECT;
	return m_pxhImageCap->SearchCapture();
}

int DD_ImageCap::GetCaptureList(zkCapDevDesc **ppDescs,int &nCount)
{
	DKQ_SECT
	return m_pxhImageCap->GetCaptureList(ppDescs,nCount);
}

int DD_ImageCap::SelectCapture(zkCapDevDesc *pDesc)
{
	DKQ_SECT
	return m_pxhImageCap->SelectCapture(pDesc);
}

int DD_ImageCap::RegOnDrawCallBack(OnDrawCallBackFun funCallBack,void *pContext)
{
	DKQ_SECT
	return m_pxhImageCap->RegOnDrawCallBack(funCallBack,pContext);
}

int DD_ImageCap::RegCapMsgCallBack(CapMsgCallBackFun funCallBack,void *pContext)
{
	DKQ_SECT;
	return m_pxhImageCap->RegCapMsgCallBack(funCallBack,pContext);
}

int DD_ImageCap::SetHwnd(HWND hWnd,zkScreenMon *pScreen)
{
	DKQ_SECT
	return m_pxhImageCap->SetHwnd(hWnd,pScreen);
}

// int DD_ImageCap::UnLock()
// {
// 	DKQ_SECT
// 	return m_pxhImageCap->UnLock();
// }

int DD_ImageCap::OpCaptureParam(void *pVoid)
{
	DKQ_SECT
	return m_pxhImageCap->OpCaptureParam(pVoid);
}


int DD_ImageCap::GetImageSize(int &nWidth,int &nHeight)
{
	DKQ_SECT
	return m_pxhImageCap->GetImageSize(nWidth,nHeight);
}

int DD_ImageCap::GetImageInfo(zkImgBitInfo **ppImgBitInfo)
{
	DKQ_SECT
	return m_pxhImageCap->GetImageInfo(ppImgBitInfo);
}

int DD_ImageCap::GetImageData(zkImgBitInfo **ppImgBitInfo)
{
	DKQ_SECT
	return m_pxhImageCap->GetImageData(ppImgBitInfo);
}

int DD_ImageCap::StartPreview()
{
	DKQ_SECT
	return m_pxhImageCap->StartPreview();
}

int DD_ImageCap::StopPreview()
{
	DKQ_SECT
	return m_pxhImageCap->StopPreview();
}

int	DD_ImageCap::Draw(void *pVoid)
{
	DKQ_SECT
	return m_pxhImageCap->Draw(pVoid);
}

int DD_ImageCap::GetLiveHistogramInfo(void **ppHistogram)
{
	DKQ_SECT
	return m_pxhImageCap->GetLiveHistogramInfo(ppHistogram);
}

int DD_ImageCap::GetGrayValue(int x,int y,DWORD &dwGray)
{
	DKQ_SECT
	return m_pxhImageCap->GetGrayValue(x,y,dwGray);
}

int DD_ImageCap::SelectBadPixelFile(char *pFileName)
{
	DKQ_SECT
	return m_pxhImageCap->SelectBadPixelFile(pFileName);
}

int DD_ImageCap::SelectReviseFile(char *pFileName,int nCreateRevise)
{
	DKQ_SECT
	return m_pxhImageCap->SelectReviseFile(pFileName,nCreateRevise);
}

int DD_ImageCap::GetBadPixelFileInfo(char *pFileName,void *pVoid)
{
	DKQ_SECT;
	return m_pxhImageCap->GetBadPixelFileInfo(pFileName,pVoid);
}
int DD_ImageCap::GetReviseFileInfo(char *pFileName,void *pVoid)
{
	DKQ_SECT;
	return m_pxhImageCap->GetReviseFileInfo(pFileName,pVoid);
}

int DD_ImageCap::CreateRevise(void *pVoid)
{
	DKQ_SECT
	return m_pxhImageCap->CreateRevise(pVoid);
}

int DD_ImageCap::SetReviseGrade(int nGrade)
{
	DKQ_SECT
	return m_pxhImageCap->SetReviseGrade(nGrade);
}

int DD_ImageCap::SaveReviseFile(char *pFileName)
{
	DKQ_SECT
	return m_pxhImageCap->SaveReviseFile(pFileName);
}

int DD_ImageCap::CreateBadPixelRevise(void *pVoid)
{
	DKQ_SECT
	return m_pxhImageCap->CreateBadPixelRevise(pVoid);
}

int DD_ImageCap::SetBadPixelReviseGrade(int nGrade)
{
	DKQ_SECT
	return m_pxhImageCap->SetBadPixelReviseGrade(nGrade);
}

int DD_ImageCap::SaveBadPixelReviseFile(char *pFileName)
{
	DKQ_SECT
	return m_pxhImageCap->SaveBadPixelReviseFile(pFileName);
}

int DD_ImageCap::GetBadPixelValue(int x,int y,DWORD &dwValue)
{
	DKQ_SECT
	return m_pxhImageCap->GetBadPixelValue(x,y,dwValue);
}

int DD_ImageCap::SetBadPixelValue(int x,int y,DWORD dwValue)
{
	DKQ_SECT
	return m_pxhImageCap->SetBadPixelValue(x,y,dwValue);
}


int DD_ImageCap::SetRecordParam(void *pVoid )
{
	DKQ_SECT
	return m_pxhImageCap->SetRecordParam(pVoid);
}
int DD_ImageCap::StartRecord(char *pFileName)
{
	DKQ_SECT
	return m_pxhImageCap->StartRecord( pFileName );
}
int DD_ImageCap::StopRecord()
{
	DKQ_SECT
	return m_pxhImageCap->StopRecord();
}